import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'


export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },

  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [{
      path: 'dashboard',
      name: 'Dashboard',
      component: () => import('@/views/dashboard/index'),
      meta: { title: 'Dashboard', icon: 'dashboard' }
    }]
  },
  // 业务页面路由
  {
    path: '/system/userSystem',
      component: Layout,
      meta: {
        title: '用户管理',
        icon: 'el-icon-s-tools'
      },
      children:[
        {
          path: 'user',
          component: () => import('@/views/system/userSystem/user/list'),
          meta: {
            title: '平台用户',
            icon: 'el-icon-s-help'
          }
        },
        {
          path: 'employee',
          component: () => import('@/views/system/userSystem/employee/list'),
          meta: {
            title: '平台员工',
            icon: 'el-icon-s-help'
          }
        },
        {
          path: 'account',
          component: () => import('@/views/system/userSystem/account/account'),
          meta: {
            activeMenu: '/system/userSystem',
            title: '账号信息',
          },
          hidden:true,
        },
        {
          path: 'sysLoginLog',
          component: () => import('@/views/system/safeSystem/sysLoginLog/list'),
          meta: {
            title: '登录日志',
            icon: 'el-icon-s-help'
          }
        },
      ]
  },
  // {
  //   path: '/system/safeSystem',
  //     component: Layout,
  //     meta: {
  //       title: '安全管理',
  //       icon: 'el-icon-s-tools'
  //     },
  //     children:[
  //        {
  //         path: 'sysZiDianMuLu',
  //         component: () => import('@/views/system/safeSystem/sysziDianMuLu/list'),
  //         meta: {
  //           title: '系统数据字典目录',
  //           icon: 'el-icon-s-help'
  //         }
  //       },
  //       {
  //         path: 'sysZiDianMingXi',
  //         component: () => import('@/views/system/safeSystem/sysZiDianMingXi/list'),
  //         meta: {
  //           title: '系统数据字典明细',
  //           icon: 'el-icon-s-help'
  //         }
  //       },
    
  //       {
  //         path: 'sysPermissions',
  //         component: () => import('@/views/system/safeSystem/sysPermissions/list'),
  //         meta: {
  //           title: '权限管理',
  //           icon: 'el-icon-s-help'
  //         }
  //       },
  //       {
  //         path: 'sysRole',
  //         component: () => import('@/views/system/safeSystem/sysRole/list'),
  //         meta: {
  //           title: '角色管理',
  //           icon: 'el-icon-s-help'
  //         }
  //       },   
  //       {
  //         path: 'sysLoginLog',
  //         component: () => import('@/views/system/safeSystem/sysLoginLog/list'),
  //         meta: {
  //           title: '登录日志',
  //           icon: 'el-icon-s-help'
  //         }
  //       },
  //       {
  //         path: 'sysSqlSafe',
  //         component: () => import('@/views/system/safeSystem/sysSqlSafe/list'),
  //         meta: {
  //           title: '数据库防篡改监控',
  //           icon: 'el-icon-s-help'
  //         }
  //       },
  //     ]
  // },
  {
    path: '/system/verifySystem',
      component: Layout,
      meta: {
        title: '审核项目',
        icon: 'el-icon-s-tools'
      },
      children:[
        {
          path: 'loanShenHe',
          component: () => import('@/views/system/verifySystem/loanShenHe/list'),
          meta: {
            title: '借款审核一审',
            icon: 'el-icon-s-help'
          }
        },
        {
          path: 'loanShenHe2',
          component: () => import('@/views/system/verifySystem/loanShenHe/list2'),
          meta: {
            title: '借款审核二审',
            icon: 'el-icon-s-help'
          }
        },
        {
          path: 'realauth',
          component: () => import('@/views/system/verifySystem/realauth/list'),
          meta: {
            title: '身份认证',
            icon: 'el-icon-s-help'
          }
        },
        
        {
          path: 'vedioShenHe',
          component: () => import('@/views/system/verifySystem/vedioShenHe/list'),
          meta: {
            title: '视频认证',
            icon: 'el-icon-s-help'
          }
        },
        
      ]
  },
  {
    path: '/system/financeSystem',
      component: Layout,
      meta: {
        title: '财务管理',
        icon: 'el-icon-s-tools'
      },
      children:[
        {
          path: 'bidrequestSelect',
          component: () => import('@/views/system/financeSystem/bidrequestSelect/list'),
          meta: {
            title: '借款查询',
            icon: 'el-icon-s-help'
          }
        },
         {
          path: 'publishBiao',
          component: () => import('@/views/system/verifySystem/publishBiao/list'),
          meta: {
            title: '已发布招标',
            icon: 'el-icon-s-help'
          }
        },
        
        //  {
        //   path: 'systemaccountflow',
        //   component: () => import('@/views/system/financeSystem/systemaccountflow/list'),
        //   meta: {
        //     title: '系统账号流水',
        //     icon: 'el-icon-s-help'
        //   }
        // },

         {
          path: 'companybankinfo',
          component: () => import('@/views/system/financeSystem/companybankinfo/list'),
          meta: {
            title: '公司银行账号管理',
            icon: 'el-icon-s-help'
          }
        },

        {
          path: 'systemaccount',
          component: () => import('@/views/system/financeSystem/systemaccount/list'),
          meta: {
            title: '系统账户表',
            icon: 'el-icon-s-help'
          }
        },

        
        
      ]
  },

  {
    path: '/example',
    component: Layout,
    redirect: '/example/table',
    name: 'Example',
    meta: { title: 'Example', icon: 'el-icon-s-help' },
    children: [
      {
        path: 'table',
        name: 'Table',
        component: () => import('@/views/table/index'),
        meta: { title: 'Table', icon: 'table' }
      },
      {
        path: 'tree',
        name: 'Tree',
        component: () => import('@/views/tree/index'),
        meta: { title: 'Tree', icon: 'tree' }
      }
    ]
  },

  {
    path: '/form',
    component: Layout,
    children: [
      {
        path: 'index',
        name: 'Form',
        component: () => import('@/views/form/index'),
        meta: { title: 'Form', icon: 'form' }
      }
    ]
  },




  {
    path: '/nested',
    component: Layout,
    redirect: '/nested/menu1',
    name: 'Nested',
    meta: {
      title: 'Nested',
      icon: 'nested'
    },
    children: [
      {
        path: 'menu1',
        component: () => import('@/views/nested/menu1/index'), // Parent router-view
        name: 'Menu1',
        meta: { title: 'Menu1' },
        children: [
          {
            path: 'menu1-1',
            component: () => import('@/views/nested/menu1/menu1-1'),
            name: 'Menu1-1',
            meta: { title: 'Menu1-1' }
          },
          {
            path: 'menu1-2',
            component: () => import('@/views/nested/menu1/menu1-2'),
            name: 'Menu1-2',
            meta: { title: 'Menu1-2' },
            children: [
              {
                path: 'menu1-2-1',
                component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'),
                name: 'Menu1-2-1',
                meta: { title: 'Menu1-2-1' }
              },
              {
                path: 'menu1-2-2',
                component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'),
                name: 'Menu1-2-2',
                meta: { title: 'Menu1-2-2' }
              }
            ]
          },
          {
            path: 'menu1-3',
            component: () => import('@/views/nested/menu1/menu1-3'),
            name: 'Menu1-3',
            meta: { title: 'Menu1-3' }
          }
        ]
      },
      {
        path: 'menu2',
        component: () => import('@/views/nested/menu2/index'),
        name: 'Menu2',
        meta: { title: 'menu2' }
      }
    ]
  },

  {
    path: 'external-link',
    component: Layout,
    children: [
      {
        path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
        meta: { title: 'External Link', icon: 'link' }
      }
    ]
  },

  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
